// components/authorization/authorization.js
Component({

  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    isLogin: false
  },
  lifetimes: {
    attached() {
      const app = getApp()
      const isLogin = Boolean(app.token)
      this.setData({
        isLogin
      })
      if (isLogin === false) {
        const pageStack = getCurrentPages()
        // 获取页面路径
        const currentPage = pageStack.pop()
        wx.redirectTo({
          url: '/pages/login/index?redirectURL=/' + currentPage.route,
        })
      }
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {

  }
})